import gc
from unit_test import test_suite

from application . tests import application_tests
from browser . all_tests import browser_all_tests
from clockwork . tests import clockwork_tests
from copy_menu . tests import copy_menu_tests
from creation_menu . tests import creation_menu_tests
from edit_menu . tests import edit_menu_tests
from editor . all_tests import editor_all_tests
from filesystem . tests import filesystem_tests
from gui . all_tests import gui_all_tests
from knowledge_base_directory . all_tests import knowledge_base_directory_all_tests
from knowledge_base_fetcher . tests import knowledge_base_fetcher_tests
from localization . tests import localization_tests
from logic . tests import logic_tests
from main_menu . tests import main_menu_tests
from mediator . all_tests import mediator_all_tests
from menu . all_tests import menu_all_tests
from open_menu . tests import open_menu_tests
from rename_menu . tests import rename_menu_tests
from resources . tests import resources_tests
from save_as_menu . tests import save_as_menu_tests
from table_gui . tests import table_gui_tests
from unit_test . tests import unit_test_tests
from welcome . all_tests import welcome_all_tests

gc . disable ( )

all_tests = \
    [ application_tests ] \
    + browser_all_tests + \
    [ clockwork_tests
    , copy_menu_tests
    , creation_menu_tests
    , edit_menu_tests ] \
    + editor_all_tests + \
    [ filesystem_tests ] \
    + gui_all_tests \
    + knowledge_base_directory_all_tests + \
    [ knowledge_base_fetcher_tests
    , localization_tests
    , logic_tests
    , main_menu_tests ] \
    + mediator_all_tests \
    + menu_all_tests + \
    [ open_menu_tests
    , rename_menu_tests
    , resources_tests
    , save_as_menu_tests
    , table_gui_tests
    , unit_test_tests ] \
    + welcome_all_tests

print 'Running all unit tests...'
print ''

total_time = 0
total_assumptions = 0
for module_tests in all_tests :
    suite = test_suite ( module_tests )
    suite . run ( )
    total_time += suite . get_time ( )
    total_assumptions += suite . get_assumptions ( )
    print '% 4i assumptions checked in %.4f seconds in %s testing suite' \
        % ( suite . get_assumptions ( ) , suite . get_time ( ) , suite . get_title ( ) )

print ''
print 'Successfully checked %i assumptions in %.3f seconds' % ( total_assumptions , total_time )
